from selenium.webdriver.common.by import By

from Driver.Driver import MDriver
from part import LogInFace
class RegoFace:
    driver=''
    def __init__(self):
        self.driver=MDriver.driver
    # 进入界面
    def Come(self):
        LogInFace.LogInFace().Come()
        LogInFace.LogInFace().LogInGoToRego()


    # 辅助写代码
    def QFind(self,name):
        self.driver.find_element(By.CSS_SELECTOR,name)
    # 检测界面元素
    def RegoFace(self):
        # 检测图标
        self.QFind("body > div.page.page-center > div > div.text-center.mb-4 > img")
        # 检测用户名输入框
        self.QFind("#username")
        # 检测昵称输入框
        self.QFind("#nickname")
        # 检测密码输入框
        self.QFind("#password")
        # 检测显示密码按钮
        self.QFind("#password_a > svg")
        # 检测去让人密码输入框
        self.QFind("#passwordRepeat")
        # 检测同意条款方框
        self.QFind("#policy")
        # 检测条框文字链接
        self.QFind("#signUpForm > div > div:nth-child(6) > label > span > a")
        # 检测注册按钮
        self.QFind("#submit")
        # 检测登录入口
        self.QFind("body > div.page.page-center > div > div.text-center.text-muted.mt-3 > a")
        # 检测文字及提示*号
        self.QFind("#signUpForm > div > div:nth-child(2) > label")
        self.QFind("#signUpForm > div > div:nth-child(3) > label")
        self.QFind("#signUpForm > div > div:nth-child(4) > label")
        self.QFind("#signUpForm > div > div:nth-child(5) > label")
        MDriver.photo()
    # 输入用户名
    def RegoScanfName(self,name):
        self.driver.find_element(By.CSS_SELECTOR,"#username").send_keys(name)
    # 输入昵称
    def RegoScanfFName(self,fname):
        self.driver.find_element(By.CSS_SELECTOR,"#nickname").send_keys(fname)
    # 输入密码
    def RegoScanfPass(self,Pass):
        self.driver.find_element(By.CSS_SELECTOR,"#password").send_keys(Pass)
    # 输入确认密码
    def RegoScanfAgainPass(self,Pass):
        self.driver.find_element(By.CSS_SELECTOR,"#passwordRepeat").send_keys(Pass)

    # 清空用户名输入框
    def RegoDeleteName(self):
        self.driver.find_element(By.CSS_SELECTOR,"#username").clear()
    # 清空昵称输入框
    def RegoDeleteFName(self):
        self.driver.find_element(By.CSS_SELECTOR,"#nickname").clear()
    # 清空密码输入框
    def RegoDeletePass(self):
        self.driver.find_element(By.CSS_SELECTOR,"#password").clear()
    # 清空确认密码输入框
    def RegoDeleteAgianPass(self):
        self.driver.find_element(By.CSS_SELECTOR,"#passwordRepeat").clear()


    # 勾选确认框
    def RegoCheckBox(self):
        self.driver.find_element(By.CSS_SELECTOR,"#policy").click()
    # 点及文字链接
    def RegoClickWordLink(self):
        self.driver.find_element(By.CSS_SELECTOR,"#signUpForm > div > div:nth-child(6) > label > span > a").click()
    # 点击注册按钮
    def Rego(self):
        self.driver.find_element(By.CSS_SELECTOR,"#submit").click()
    # 点击登陆按钮
    def RegoGotoLogIn(self):
        self.driver.find_element(By.CSS_SELECTOR,"body > div.page.page-center > div > div.text-center.text-muted.mt-3 > a").click()



